﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using GdNet.Integrations.Castle.Facilities;
using GdNet.Web.Assistants;

namespace GdNet.Integrations.Castle.Installers
{
    public class PersistenceInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            if (ApplicationAssistant.IsWebContext())
            {
                container.AddFacility<WebPersistenceFacility>();
            }
            else
            {
                container.AddFacility<ApplicationPersistenceFacility>();
            }
        }
    }
}
